import type { App } from "vue";
import { createRouter, createWebHistory } from "vue-router";

import type { RouteRecordRaw } from "vue-router";
import { LAYOUT } from "./constant";

const routes: RouteRecordRaw[] = [
  {
    path: "/",
    name: "Layout",
    component: LAYOUT,
    redirect: "/home",
    children: [
      {
        path: "home",
        name: "home",
        component: () => import("@/views/home/index.vue"),
      },
      {
        path: "note",
        name: "Annotation",
        component: () => import("@/views/annotation/index.vue"),
      },
    ],
  },
];

export const router = createRouter({
  history: createWebHistory(),
  strict: true,
  routes,
});

export function setupRouter(app: App<Element>) {
  app.use(router);
}
